package com.gy.study.dubbo.web;

import com.gy.study.dubbo.User;
import com.gy.study.dubbo.UserInterface;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {

//    @DubboReference(timeout = 1000)
    @DubboReference
    UserInterface userInterface;

    @GetMapping("hello")
    public String hello(String username){
        return userInterface.hello(username);
    }

    @GetMapping("getById")
    public User getById(Long id){
        User user = new User();
        user.setId(id);
        return userInterface.getById(user);
    }
}
